package com.family.menage.controller;

import java.util.Arrays;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import com.family.menage.entity.SchoolEntity;
import com.family.menage.service.SchoolService;
import com.family.common.utils.PageUtils;
import com.family.common.utils.R;



/**
 * 
 *
 * @author Qzy
 * @email 2434785870@qq.com
 * @date 2021-09-15 09:58:28
 */
@RestController
@RequestMapping("menage/school")
public class SchoolController {

    @Autowired
    private SchoolService schoolService;

    /**
     * 后台学校管理列表
     * */
    @RequestMapping("/findAll")
    public List<SchoolEntity> findAll(@RequestBody SchoolEntity vo){
        return schoolService.findAll(vo);
    }


    /**
     * 列表
     */
    @RequestMapping("/list")
    public List<SchoolEntity> list(@RequestBody SchoolEntity vo){
        return  schoolService.findAll(vo);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{id}")
    public R info(@PathVariable("id") Integer id){
		SchoolEntity school = schoolService.getById(id);

        return R.ok().put("school", school);
    }

    /**
     * 学校信息保存
     */
    @RequestMapping("/save")
    public R save(@RequestBody SchoolEntity school){
		schoolService.save(school);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    public R update(@RequestBody SchoolEntity school){
		schoolService.updateById(school);

        return R.ok();
    }

    /**
     * 通过Id删除学校信息
     */
    @RequestMapping("/delete/{id}")
    public String delete(@PathVariable("id") Integer id){
		schoolService.removeById(id);
        return "1";
    }

}
